package com.awifi.demo.netty.tcp;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelOption;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;

/**
 * @description: ToDo
 * @author: marin
 * @time: 2020/9/15 17:10
 */
public class NettyServer {
    public static void main(String[] args) {
        NioEventLoopGroup bossGroup = new NioEventLoopGroup();
        NioEventLoopGroup workerGroup = new NioEventLoopGroup();

        ServerBootstrap bootstrap = new ServerBootstrap();
        bootstrap.group(bossGroup,workerGroup)  //设置两个线程组
                .channel(NioServerSocketChannel.class) //使用NioSocketChannel
                .option(ChannelOption.SO_BACKLOG,128) //设置线程队列得到的连接个数
                .childOption(ChannelOption.SO_KEEPALIVE,true); //设置保持活动连接状态


    }
}
